package com.hmall.search.web;


import com.hmall.common.client.ItemClient;
import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.SearchDTO;
import com.hmall.common.pojo.Item;
import com.hmall.common.vo.SearchVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/search")
@Slf4j
@RequiredArgsConstructor
public class SearchController {

    private final ItemClient itemClient;
    @PostMapping("/filters")
    public SearchVO filter(@RequestBody SearchDTO searchDTO){
        return itemClient.filter(searchDTO);
    }

    @PostMapping("/list")
    public PageDTO<Item> list(@RequestBody SearchDTO searchDTO){
        return itemClient.list(searchDTO);
    }
}
